<%@ page contentType="text/html; charset=UTF-8" %>
<%@page import="com.infomanage.enums.*"%>
<%  response.addDateHeader("Expires", 0);response.setHeader("Pragma","no-cache"); response.setHeader("Cache-Control","no-cache");%>
<%
	com.infomanage.po.User user = (com.infomanage.po.User) request.getSession().getAttribute(com.infomanage.util.Consts.LOGINED_USER);
%>
<html>
<head>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<title>矿山救护远程调度管理指挥系统</title>
	<link href="../../css/style.css" rel="stylesheet" type="text/css">
	<link href="../../css/table.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="../../js/common.js"></script>
	<script type="text/javascript">

		// 查询
	    function search() {
	    	var queryInputObj = document.getElementById("queryInputObj");	
			var querySelObj = document.getElementById("querySelObj");
			if(queryInputObj.style.display == ""){
				searchForm.queryValue.value = queryInputObj.value;
			}else {
				searchForm.queryValue.value = querySelObj.value;
			}
			//alert(searchForm.queryName.value + "=" + searchForm.queryValue.value);
	    	searchForm.submit();
		}

		// 新增
		function addItem() {
			var url = "personManage_edit.jsp";
			var width = '1000px';
			var height ='1000px';
			var arg = "dialogHeight:" + height + ";dialogWidth:" + width + ";status:no;location:no;";
			//window.open(url);
			var returnValue = window.showModalDialog(url, "", arg);
			//window.location.reload();
			dataFrame.location.reload();
		}
		
	    function print() {
	    var currPageNum =  document.frames("dataFrame").document.getElementById("pageForm").currPageNum.value;
	    	var queryInputObj = document.getElementById("queryInputObj");	
			var querySelObj = document.getElementById("querySelObj");
			var queryName = document.getElementById("queryName").value;
			var queryValue = "";
			if(queryInputObj.style.display == ""){
				queryValue = queryInputObj.value;
			}else {
				queryValue = querySelObj.value;
			}
			var url = "personManage_print.jsp?"+queryName+"="+queryValue+"&currPageNum="+currPageNum;
		    window.location.href=url
		    
		}

		// 切换查询项
		function changeQueryName(obj){
			var queryInputObj = document.getElementById("queryInputObj");	
			var querySelObj = document.getElementById("querySelObj");
			var queryTreeObj = document.getElementById("queryTreeObj");
			var queryName = obj.value;
			if(queryName == "name" ){
				queryInputObj.name="name";
				queryInputObj.style.display = "";
				querySelObj.style.display = "none";
				queryTreeObj.style.display = "none";
				querySelObj.name="";
			}
			else if(queryName == "dept"){
				queryTreeObj.name="dept";
				queryTreeObj.style.display = "";
				queryInputObj.style.display = "none";
				querySelObj.style.display = "none";
			}
			else {
				queryInputObj.style.display = "none";
				queryTreeObj.style.display = "none";
				querySelObj.style.display = "";
				querySelObj.options.length = 0;
				queryInputObj.name="";
				if(queryName == "degree"){
			    	addDegreeOptions(querySelObj);
					
			    }else if(queryName == "techlevel"){
			    	addTechlevelOptions(querySelObj);
					
			    }else if(queryName == "adminlevel"){
			    	addAdminOptions(querySelObj);
			    }else if(queryName == "position"){
			    	addPositionOptions(querySelObj);
			    }else if(queryName == "sex"){
			    	addSexOptions(querySelObj);
			    }
			}
	    }

	    // 添加查询值下来列表
	    
	    // 添加学历列表
	    function addDegreeOptions(selObj) {
	    	selObj.name = "highestDigree";
		    var opt = null;
			<%
				for(DegreeType degree : DegreeType.values()) {
			%>
				opt = new Option("<%=degree.title()%>", "<%=degree.value()%>");
				selObj.options.add(opt);     
			<%		
				}
			%>
	    }
	    
	    // 添加技术级别列表
	    function addTechlevelOptions(selObj) {
	  	  selObj.name = "techlevel";
		    var opt = null;
			<%
				for(TechnicDegreeType tech : TechnicDegreeType.values()) {
			%>
				opt = new Option("<%=tech.title()%>", "<%=tech.value()%>");
				selObj.options.add(opt);     
			<%		
				}
			%>
	    }
	    
	    // 添加行政级别列表
	    function addAdminOptions(selObj) {
	    	selObj.name = "adminlevel";
		    var opt = null;
			<%
				for(AdministrationDegreeType admin : AdministrationDegreeType.values()) {
			%>
				opt = new Option("<%=admin.title()%>", "<%=admin.value()%>");
				selObj.options.add(opt);     
			<%		
				}
			%>
	    }
	    
	    // 添加职务列表
	    function addPositionOptions(selObj) {
	    	selObj.name = "position";
		    var opt = null;
			<%
				for(PositionType type : PositionType.values()) {
			%>
				opt = new Option("<%=type.title()%>", "<%=type.value()%>");
				selObj.options.add(opt);     
			<%		
				}
			%>
	    }
	    
	    // 添加性别列表
	    function addSexOptions(selObj) {
	    	selObj.name = "sex";
		    var opt = null;
			<%
				for(SexType type : SexType.values()) {
			%>
				opt = new Option("<%=type.title()%>", "<%=type.value()%>");
				selObj.options.add(opt);     
			<%		
				}
			%>
	    }
	</script>
<body rightmargin="0" bottommargin="0" leftmargin="0" topmargin="0" onclick="clickBody();" style="background: #ffffff;">
<form name="searchForm" id="searchForm" action="personManage_data.jsp" target="dataFrame" method="get">
<table width="100%" height="100%"  border="0" align="center" cellpadding="0" cellspacing="0" style="table-layout: fixed;">
	<!-- 位置导航栏 -->
	<tr height="25px">
		<td width="100%" align="center" valign="top">
			 <table width="98%" border="0" cellpadding="0" cellspacing="0" class="tabtitle">
              <tr>
                <td width="4%" valign="top"><img src="../../img/pic_dot1.gif" width="37" height="22"></td>
                <td width="96%" valign="middle">当前位置：<a  class="n">信息管理系统</a> &gt;&gt; <a class="n">人员管理</a> &gt;&gt; <a  class="n">员工管理</a></td>
              </tr>
            </table>
		</td>
	</tr>
   
   <!-- 查询工具条 -->
   <tr height="29px">
	   <td valign="top">
	   		<table width="98%" height="29" cellpadding="0" cellspacing="0" align="center" border="0">
	   			<tr height="100%">
		   			<td class="td_title" width="420" align="left">
		   				<select name="queryName" style="width: 140px;margin-left: 5px;" onchange="changeQueryName(this);">
		   					<option value="name">姓名</option>
		   					<option value="sex">性别</option>
		   					<option value="dept">所属单位</option>
		   					<option value="position">职务</option>
		   					<option value="degree">学历</option>
		   					<option value="techlevel">技术级别</option>
		   					<option value="adminlevel">行政级别</option>
		   				</select>
		   				<input type="hidden" name="queryValue">
		   				<input id="queryInputObj" name="name" type="text" style="width: 250">
		   				<span id="queryTreeObj" class="treeSpan" onclick="showTree(this, '../common/deptTree.jsp');" treeSelect="true" style="display:none;width: 250" >
								<input name="deptname" value="" style="width: 250" readonly="readonly" 
								treeSelect="true"><input name="deptId" value="" type="hidden">
						</span>
		   				<select id="querySelObj" style="width: 250;display:none;"></select>
		   			</td>
		   			<td class="td_title" style="border-right: 1px #a3c6e2 solid;border-left: none;padding-left:20px;">
							<input name="Button12" type="button" class="button_cx" value="" title="查询" onclick="search();">
					</td>
	   			</tr>
	   		</table>
	   </td>
   </tr>
   
   <!-- 空格 -->
   <tr height="3px">
		<td>
			&nbsp;
		</td>
   </tr>
   
    <!-- 工具按钮 -->
    <tr height="30px">
      <td width="100%" align="center" valign="top" bgcolor="#FFFFFF" >
        <table width="98%" border="0" cellpadding="0" cellspacing="0" class="td_button">
          <tr>
          	<%
				if(user != null && user.getRoleId() != com.infomanage.enums.RoleType.GENERALUSER.value()){
			%>
            <td width="55px"><a href="#" onclick="javascript:addItem();"><img src="../../img/button_xz.gif" width="55" height="24" border="0"></a></td>
            <td width="55px"><a href="#" onclick="javascript:delBatch();"><img src="../../img/button_sc.gif" width="55" height="24" border="0"></a></td>
            <%
				}
			%>
            <td width="55px"><a href="#" onclick="javascript:print();"><img src="../../img/button_dy.gif" width="55" height="24" border="0"></a></td>
            <td>&nbsp;</td>
          </tr>
        </table>
      </td>
   </tr>
   
   <!-- 空格 -->
   <tr height="5px">
		<td>
			&nbsp;
		</td>
   </tr>
   
   <!-- 数据列表 -->
   <tr>
	<td align="center">
		<iframe src="personManage_data.jsp"  name="dataFrame" frameborder="0" width="98%" height="100%" scrolling="no"></iframe>
	</td>
   </tr>
</table>
<!-- 隐藏树 -->
<iframe src="#" frameborder="0" id="treeFrame" name="frame" style="display: none;position: absolute;"></iframe>
</form>

<!-- 批量删除表单  -->
<form action="personManage_action.jsp" name="delForm" target="actionFrame">
	<input type="hidden" value="delBatch" name="actionType">
	<input type="hidden" value="" name="batchIds">
</form>
<iframe src="#" name="actionFrame" style="display: none;"></iframe>
</body>
</html>
